package com.cloud.code.线程;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class User {

    public static void main(String[] args) throws ExecutionException, InterruptedException {

        System.out.println("去散步，并且遛狗");
        Dog dog = new Dog();
        FutureTask<String> result = new FutureTask<String>(dog);
        new Thread(result).start();

        String res = null;
        try {
            res = result.get();
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println(res);

    }
}
